package com.ccdt.tv.smartrecommend.view.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.ViewGroup;

import com.ccdt.tv.smartrecommend.R;
import com.ccdt.tv.smartrecommend.presenter.MainActivity.MainActivityContract;
import com.ccdt.tv.smartrecommend.presenter.MainActivity.MainActivityPresenter;
import com.ccdt.tv.smartrecommend.service.RecommendService;

public class MainActivity extends AppCompatActivity implements MainActivityContract.View {
    MainActivityPresenter mPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mPresenter = new MainActivityPresenter();
        mPresenter.attachView(this);

//        Window window = getWindow();
//        WindowManager.LayoutParams wl = window.getAttributes();
//        wl.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
//        wl.alpha = 0.6f;//这句就是设置窗口里控件的透明度的．０.０全透明．１.０不透明．
//        window.setAttributes(wl);

//        Intent intent = new Intent(this, SmartService.class);
//        startService(intent);
        Intent intent = new Intent(this, RecommendService.class);
        startService(intent);
//        showIntelligenceEpg();

        mPresenter.getRecordList();

    }


    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);

    }




    @Override
    protected void onStart() {
        super.onStart();
        mPresenter.doBindExtraService();

    }

    @Override
    protected void onResume() {
        super.onResume();

    }

    @Override
    protected void onPause() {
        super.onPause();

    }

    @Override
    protected void onStop() {
        super.onStop();
        mPresenter.doUnBindExtraService();

    }


    @Override
    protected void onDestroy() {

        super.onDestroy();
    }

    /**
     * 获取根布局
     *
     * @param context
     * @return
     */
    private ViewGroup getRootView(Activity context) {
        return ((ViewGroup) context.findViewById(android.R.id.content));
    }

}
